import Vue from 'vue'
import VueRouter from 'vue-router'


const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/views/Home'),
    children: [
      {
        path: '/systemSetting',
        name: 'systemSetting',
        component: () => import('@/views/system/SystemSetting'),
        children: [
          {
            path: '/systemSetting/menuList',
            name: 'MenuList',
            component: () => import('@/views/system/menus/MenuList')
          },
          {
            path: '/systemSetting/basicAuth',
            name: 'BasicAuth',
            component: () => import('@/views/authority/BasicAuth.vue')
          },
          {
            path: '/systemSetting/dataAuth',
            name: 'DataAuth',
            component: () => import('@/views/authority/DataAuth.vue'),

          },
          {
            path: '/systemSetting/dsConns',
            name: 'DataSourceList',
            component: () => import('@/views/system/datasource/ConnectionManage')
          }
        ]
      },
      {
        path: '/featureCenter',
        name: 'featureCenter',
        component: () => import('@/views/feature/FeatureCenter'),
        children: [
          {
            path: '/featureCenter/basicType',
            name: 'basicType',
            component: () => import('@/views/feature/FeatureManage'),
            meta: {
              name: 'basic',
              description: '基础类型'
            }
          },
          {
            path: '/featureCenter/businessType',
            name: 'businessType',
            component: () => import('@/views/feature/FeatureManage'),
            meta: {
              name: 'business',
              description: '业务特征'
            }
          },
        ]
      },
      {
        path: '/knowledgeCenter',
        name: 'knowledgeCenter',
        component: () => import('@/views/knowledge/KnowledgeCenter')
      },
    ]
  },
]

let originPush = VueRouter.prototype.push;

VueRouter.prototype.push = function (location, resolve, reject) {
  if (resolve && reject) {
    originPush.call(this, location, resolve, reject);
  } else {
    originPush.call(this, location, () => {}, () => {});
  }
}

const router = new VueRouter({
  routes
})

Vue.use(VueRouter);

export default router
